package com.itfreer.print.toPdf;

import org.junit.Test;

import com.itextpdf.tool.xml.exceptions.CssResolverException;
import com.itfreer.print.toWord.HtmlToWord;
import com.itfreer.print.toWord.HtmlToWordImp;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * html转pdf测试
 */
public class HtmlToPdfTest2 {

	/**
	 * 转PDF
	 * @throws Exception 
	 * 
	 * @throws CssResolverException
	 */
	@Test
	public void toDdf() throws Exception {
		String inFile = "/Volumes/work/share/temp/print/red.html";
		String outFile = "/Volumes/work/share/temp/print/red.pdf";
		
		FileInputStream htmlFile = new FileInputStream(inFile);
		FileOutputStream pdfFile = new FileOutputStream(outFile);
		HtmlToPdf toPdf = new HtmlToPdfImp();
		toPdf.toPdf(htmlFile, pdfFile);
	}
	
	@Test
	public void toWord() throws Exception {
		String inFile = "/Volumes/work/share/temp/print/red.html";
		String outFile = "/Volumes/work/share/temp/print/red.doc";
		
		FileInputStream htmlFile = new FileInputStream(inFile);
		FileOutputStream pdfFile = new FileOutputStream(outFile);
		HtmlToWord toPdf = new HtmlToWordImp();
		toPdf.toWord(htmlFile, pdfFile);
	}
}